<?php $this->pageTitle = 'Forms'; ?>
<?php Yii::app()->clientScript->registerScriptFile('/js/jquery.cookie/jquery.cookie.js'); ?>

<div class="flat_area">
    <div class="grid_16 content_header clearfix">
        <h1 class="float-left">Forms & Documents</h1>
    </div>
    <div class="grid_16 relative">
        <div id="ps-dashboard-propertycases" class="box">
            <h2 class="box_head grad_colour with-icon"><img width="16" height="16" src="/images/icons/fugue/folder.png" />Recently Submitted Forms</h2>
                <?php
                $this->widget('zii.widgets.grid.CGridView', array(
                    'id' => 'dashboard-property-case-grid',
                    'dataProvider' => $propertyCaseForm->getSubmittedFormsDataProvider(),
                    'template' => '{items}',
                    'emptyText' => $emptyText,
                    'htmlOptions' => array(
                        'class' => 'grid-view grey'
                    ),
                    'columns' => array(
//                            array(
//                                'header' => 'Date',
//                                'name' => 'create_time',
//                                'value' => 'date("d M Y", strtotime($data->create_time))',
//                                'sortable' => true,
//                            ),
                        array(
                            'header' => 'Time Submitted',
                            'value' => 'DateFormatter::ago($data->submit_time)'
                        ),
//                        array(
//                            'header' => 'Form',
//                            'type' => 'raw',
//                            'value' => '$data->pdfForm->group'
//                        ),
                        array(
                            'header' => '',
                            'type' => 'raw',
                            'value' => '$data->pdfForm->shortname'
                        ),
                        array(
                            'header' => 'Form Name',
                            'type' => 'raw',
                            'value' => '$data->pdfForm->name'
                        ),
                        array(
                            'header' => 'Submitted',
                            'name' => 'propertyCase.user.name'
                        ),
                        array(
                            'header' => 'Actions',
                            'class' => 'common.widgets.grid.PsActionColumn', // protected/components/PsActionColumn.php
                            'htmlOptions' => array('class' => 'action-column'),
                            'options' => array(
                                'width' => 120,
//                                'onSelect' => 'js:propsage.propertycase.update.onFormActionSelect'
                            ),
                            'actions' => array(
                                'view' => array(
                                    'label' => 'View / Print',
                                    'icon' => '/images/icons/fugue/document.png',
                                    'class' => 'case-form-action-view',
                                    'url' => array('form/pdf', 'id' => '$data->id'),
                                    'target' => '_blank'
                                ),
                                'opencase' => array(
                                    'label' => 'Go to Case',
                                    'icon' => '/images/icons/fugue/folder-open.png',
                                    'class' => 'case-form-action-open',
                                    'url' => array('case/view', 'id' => '$data->propertyCase->id'),
                                    'target' => '_blank'
                                ),
                            )
                        ),
                    ),
                ));
                ?>
        </div>
    </div>
</div>
<script type="text/javascript">
    var welcomePopupEnabled = <?php echo ($welcomePopupEnabled ? "true" : "false"); ?>;
    var showWhatsNew = <?php echo ($showWhatsNew ? "true" : "false"); ?>;
</script>